package elm.example.util;

import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/*
    classDescription:接口文档辅助类，进行接口文档的名称设置、版本信息和作者信息设置
*/

@Configuration
public class DocConfig {
    @Bean
    public GroupedOpenApi publicApi() {
        return GroupedOpenApi.builder()
                .addOpenApiCustomizer(openApi -> openApi.setInfo(apiInfo())).group("public")
                .packagesToScan("elm.example.controller").build();
    }

    private Info apiInfo() {
        return new Info().title("接口说明").description("elm接口文档").contact(new Contact().name("yjli").email("1604742378@qq.com")).version("v1.0");
    }
}
